#include "LQ_demo.hpp"

/*LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
 * @函数名称：void ServoDemo()
 * @功能说明：舵机功能测试
 * @参数说明：无
 * @函数返回：无
 * @调用方法：ServoDemo();
 * @备注说明：无
 QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ*/
void ServoDemo()
{
    /* 舵机PWM */
    GtimPwm ServoPWM1(88, 2, LS_GTIM_INVERSED, 2000000 - 1, 155000); // TIM2_CH2 GPIO88   舵机
    GtimPwm ServoPWM2(89, 3, LS_GTIM_INVERSED, 2000000 - 1, 155000); // TIM2_CH3 GPIO89   负压
    ServoPWM1.Enable();
    ServoPWM2.Enable();
    while (1)
    {
        ServoPWM1.SetDutyCycle(138000);
        ServoPWM2.SetDutyCycle(120000);
        printf("PWM Set %d\n", 130000);
        sleep(1);
        ServoPWM1.SetDutyCycle(155000);
        ServoPWM2.SetDutyCycle(150000);
        printf("PWM Set %d\n", 150000);
        sleep(1);
        ServoPWM1.SetDutyCycle(172000);
        ServoPWM2.SetDutyCycle(180000);
        printf("PWM Set %d\n", 180000);
        sleep(1);

    }
}
